package com.androidx.p013lv.base;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.bean.event.AppLinkEvent;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.utils.SpUtils;
import com.androidx.p013lv.base.utils.UrlParse;
import java.util.Map;
import org.greenrobot.eventbus.EventBus;

/* renamed from: com.androidx.lv.base.APPLink */
public class APPLink {
    String content = "caolong://cao/content";
    Context context;
    String group = "caolong://cao/group";
    String inner = "caolong://cao/activity";
    String official = "caolong://cao/meet/official";
    String rech = "caolong://cao/rech";
    String share = "caolong://cao/share";
    String square = "caolong://cao/meet/square";
    String video = "caolong://cao/video";
    String wall = "caolong://cao/wall";

    public APPLink(Context context2) {
        this.context = context2;
    }

    public void urlLink(String str) {
        String str2;
        if (!TextUtils.isEmpty(str)) {
            try {
                Map<String, String> urlParams = UrlParse.getUrlParams(str);
                if (str.contains(this.video)) {
                    ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(Integer.parseInt(urlParams.get(Key.VIDEO_ID)))).navigation();
                } else if (str.contains(this.rech)) {
                    urlParams.get("type");
                    ARouter.getInstance().build(Constance.VIP_CENTER_ACTIVITY).withString(Key.BACK_TITLE, "返回").navigation();
                } else if (str.contains(this.wall)) {
                    ARouter.getInstance().build(Constance.WALLET_ACTIVITY).navigation();
                } else if (str.contains(this.share)) {
                    ARouter.getInstance().build(Constance.SHARE_ACTIVITY).navigation();
                } else if (str.contains(this.group)) {
                    ARouter.getInstance().build(Constance.ADD_GROUP_ACTIVITY).navigation();
                } else if (str.contains(this.content)) {
                    ARouter.getInstance().build(Constance.STAR_INFO_ACTIVITY).withInt("type", Integer.parseInt(urlParams.get("contentId"))).withString(Key.TXT, "返回").navigation();
                } else if (str.contains(this.inner)) {
                    String str3 = urlParams.get("inner");
                    if (UrlParse.getUrlParams(str3).entrySet().size() > 0) {
                        str2 = str3 + "&token=" + SpUtils.getInstance().getString(Key.TOKEN);
                    } else {
                        str2 = str3 + "?token=" + SpUtils.getInstance().getString(Key.TOKEN);
                    }
                    ARouter.getInstance().build(Constance.WEB_VIEW_ACTIVITY).withString(Key.WEB_VIEW_URL, str2).withString(Key.TITLE, "").navigation();
                } else if (str.contains(this.official)) {
                    EventBus.getDefault().post(new AppLinkEvent(0));
                } else if (str.contains(this.square)) {
                    EventBus.getDefault().post(new AppLinkEvent(1));
                } else {
                    Intent intent = new Intent();
                    intent.setAction("android.intent.action.VIEW");
                    intent.setData(Uri.parse(str));
                    this.context.startActivity(intent);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
